<?php
//获得属性规格表单
class GoodsSpecModel extends Model{
	public $table="add_goods_type";
	public function goodsSpec($gtid){
            //获得属性值
            $attrClassDate=M("g_attr_class")->where(array("add_goods_type_aid"=>$gtid,"is_spec"=>1))->all();
            if(!is_null($attrClassDate)){
              foreach($attrClassDate as $n=>$attrClass){
                   $attrValue=M("g_arr_value")->where(array("g_attr_class_ac_id"=>$attrClass["ac_id"]))->all();

                   $func=$attrClass["show_type"];
                   if(method_exists($this,$func)){
                    $attrClassDate[$n]['html']=$this->$func($attrValue);          
                   }
               }
                return $attrClassDate;
            }
            return ;
	 }
        //box模型
        public function box($attrValue){
          // if(!is_null($attrValue)){
                $html="<select name='spec"."[".$attrValue[0]['g_attr_class_ac_id']."]"."[]'>";
               foreach ($attrValue as $Value){
                $html.="<option value='{$Value['av_id']}|{$Value['av_name']}'>".$Value['av_name']."</option>";
                };
              return $html;
             }
          // }
          // return ;
        	
}






